package com.yeban.javase.day01;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/9
 */
public class Person {

    //私有属性
    private String name;
    private int age;
    private String sex;

    //公开的getter和setter方法
    //获取姓名
    public String getName(){
        return name;
    }
    //设置姓名
    public void setName(String name){
        this.name = name;
    }

    public int getAge(){
        return age;
    }

    public void setAge(int age){
        this.age = age;
    }

    public String getSex(){
        return sex;
    }

    public void setSex(String sex){
        if(sex.equals("男") || sex.equals("女")){
            this.sex = sex;
        }
    }

    //构造方法
    public Person(){

    }

    public Person(String name, int age , String sex){
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    //成员方法
    public void study(){
        System.out.println("一位"+sex+" - "+name+"学习中~");
    }

    public void sleep(){
        System.out.println(name+"睡觉中~");
    }
}
